<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div class="box">
      <div class="inner"></div>
    </div>
  </body>
  <style>
    .box {
      position: relative;
      width: 300px;
      height: 300px;
      box-sizing: border-box;
      background: red;
    }
    .inner {
      position: absolute;
      background: #000;
      z-index: 10;
      width: 100px;
      height: 100px;
      margin-top: 100px;
      margin-left: 100px;
      top: 100px;
      left: 100px;
      /* 边界为margin来进行改变 */
    }
  </style>
</html>
